package com.jyw.system.domain.vo;

import com.jyw.common.annotation.Conversion;
import com.jyw.common.core.domain.entity.SysUser;
import com.jyw.common.enums.ConversionType;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.FieldNameConstants;

/**
 * @author 沈峻
 * @ClassName UserCacheVo
 * @Description TODO
 * @Date 2023/8/25 17:48
 **/
@Data
@ApiModel("用户缓存数据")
@NoArgsConstructor
@FieldNameConstants
public class UserCacheVo {

    @ApiModelProperty("id")
    @Conversion(value = ConversionType.USER,name = Fields.nickName)
    private Long userId;

    @ApiModelProperty("用户名称")
    private String nickName;

    @ApiModelProperty("用户状态 0正常 1停用 2删除")
    private String status;

    public UserCacheVo(SysUser user) {
        setUserId(user.getUserId());
        setNickName(user.getNickName());
        if(user.getDelFlag().equals("2")){
            setStatus("2");
        }else{
            setStatus(user.getStatus());
        }
    }
}
